package com.clothes.aweiDoExercises.mapper;

import com.clothes.aweiDoExercises.model.entity.Question;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
* @author 衣英伟
* @description 针对表【question(题目)】的数据库操作Mapper
* @createDate 2025-04-17 23:19:45
* @Entity generator.domain.Question
*/
public interface QuestionMapper extends BaseMapper<Question> {

    /**
     * 查询题目列表，包含已逻辑删除的题目
     * @param minUpdateTime 表示最近几分钟更新的题目
     * @return
     */
    @Select("select * from question where updateTime >= #{minUpdateTime}")
    List<Question> listQuestionWithDelete(Date minUpdateTime);

    /**
     * 查询题目标签
     * @return
     */
    @Select("SELECT DISTINCT tag " +
            "FROM question, " +
            "JSON_TABLE(tags, '$[*]' COLUMNS (tag VARCHAR(255) PATH '$')) AS t " +
            "WHERE tags IS NOT NULL")
    List<String> getTags();
}




